﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Urb.Weather.Core.Engine
{
    public class WorkItem : IWorkItem
    {
        public Action Action { get; set; }

        public void Execute(IEngine engine)
        {
            if (Action != null)
                Action();
        }
    }

    public class WorkItem<TParameter1> : IWorkItem
    {
        public TParameter1 Parameter1 { get; set; }
        public Action<TParameter1> Action { get; set; }

        public void Execute(IEngine engine)
        {
            if (Action != null)
                Action(Parameter1);
        }
    }

    public class WorkItem<TParameter1, TParameter2> : IWorkItem
    {
        public TParameter1 Parameter1 { get; set; }
        public TParameter2 Parameter2 { get; set; }
        public Action<TParameter1, TParameter2> Action { get; set; }

        public void Execute(IEngine engine)
        {
            if (Action != null)
                Action(Parameter1, Parameter2);
        }
    }

    public class WorkItem<TParameter1, TParameter2, TParameter3> : IWorkItem
    {
        public TParameter1 Parameter1 { get; set; }
        public TParameter2 Parameter2 { get; set; }
        public TParameter3 Parameter3 { get; set; }
        public Action<TParameter1, TParameter2, TParameter3> Action { get; set; }

        public void Execute(IEngine engine)
        {
            if (Action != null)
                Action(Parameter1, Parameter2, Parameter3);
        }
    }

    public class WorkItem<TParameter1, TParameter2, TParameter3, TParameter4> : IWorkItem
    {
        public TParameter1 Parameter1 { get; set; }
        public TParameter2 Parameter2 { get; set; }
        public TParameter3 Parameter3 { get; set; }
        public TParameter4 Parameter4 { get; set; }
        public Action<TParameter1, TParameter2, TParameter3, TParameter4> Action { get; set; }

        public void Execute(IEngine engine)
        {
            if (Action != null)
                Action(Parameter1, Parameter2, Parameter3, Parameter4);
        }
    }
}
